[+breadcrumb+]
<h1 id="caption">Photo caption</h1>

<div id="gallery-photo-nav">[+image.nav+]</div>
<div id="gallery-photo">
    [+view.gallery+]
</div>
<script type="text/javascript">
    var image_count = [+image.count+];
    var current_index = [+image.selected+];

    function change_image(index)
    {
        for (i = 1; i <= image_count; i++)
        {
            $('#gallery-image-' + i).hide();
        }
        $('#caption').html($('#gallery-image-' + current_index).attr('name'));
        $('#gallery-image-' + current_index).show();
    }
    change_image(current_index);

    $('#next').click(function(){
        current_index++;
        if (current_index > image_count)
        {
            current_index = 1;
        }
        change_image(current_index);
    });

    $('#prev').click(function(){
        current_index--;
        if (current_index < 1)
        {
            current_index = image_count;
        }
        change_image(current_index);
    });
</script>